
************************************************************************************************************************************************
************************************************************************************************************************************************
***This file corresponds to the analysis of Black adults in the experiment reported in Perez, Vicuna, and Ramos (2022) in Research & Politics***
************************************************************************************************************************************************
************************************************************************************************************************************************


/*code demographics*/

**keep african americans participants

gen black=0
recode black(0=1) if Q1==2
drop if black==0

**age

gen age=Q5
recode age(1=18)(2=19)(3=20)(4=21)(5=22)(6=23)(7=24)(8=25)(9=26)(10=27)(11=28)(12=29)(13=30)(14=31)(15=32)(16=33)(17=34)(18=35)(19=36)(20=37)(21=38)(22=39)(23=40)(24=41)(25=42)(26=43)(27=44)(28=45)(29=46)(30=47)(31=48)(32=49)(33=50)(34=51)(35=52)(36=53)(37=54)(38=55)(39=56)(40=57)(41=58)(42=59)(43=60)(44=61)(45=62)(46=63)(47=64)(48=65)(49=66)(50=67)(51=68)(52=69)(53=70)(54=71)(55=72)(56=73)(57=74)(58=75)(59=76)(60=77)(61=78)
summ age
summ age, detail

**gender

gen female=0
recode female(0=1) if Q6==1 
tab female

**ideology

gen liberal=Q8
summ liberal

summ age, detail
summ female, detail
summ liberal, detail


/*code experimental treatments*/

**treatments

encode m1, gen(treats)

gen inferior=0
recode inferior(0=1) if treats==2

gen american=0
recode american(0=1) if treats==3

tab inferior american
tab inferior
tab american

**generate comparison of american treatment to conrol only

gen american2=.
recode american2(.=1) if american==1
recode american2(.=0) if treats==1
tab american2


/*balance check*/

ttest age, by(american2)
ttest female, by (american2)  
ttest liberal, by (american2)

reg american2 age female liberal
test age female liberal


/*code manipulation checks per each condition*/

**control manipulation check

drop if Q14==2

**inferior manipulation check

drop if Q15==2

**american manipulation check

drop if Q16==2


/*code mediator - solidarity with poc*/

gen poc1=Q17
summ poc1

gen poc2=Q18
recode poc2(1=5)(2=4)(3=3)(4=2)(5=1)
summ poc2

pwcorr poc1 poc2, sig

gen pocsolid1=(poc1+poc2)/2
summ pocsolid1

gen pocsolid=(pocsolid1-1)/4
summ pocsolid


/*code outcomes*/

**pro-latino policy

gen borderpat1=Q19
recode borderpat1(1=5)(2=4)(3=3)(4=2)(5=1)
summ borderpat1

gen daca1=Q20
summ daca1

gen pathway1=Q21
summ pathway1

alpha borderpat1 daca1 pathway1, std
pwcorr borderpat1 daca1 pathway1, sig

**pro-black policy 

gen hatecrime1=Q22
summ hatecrime1

gen blm1=Q23
recode blm1(1=5)(2=4)(3=3)(4=2)(5=1)
summ blm1

gen repar1=Q23
summ repar1

pwcorr hatecrime1 blm1 repar1, sig

**exclude repar1 from further analysis


/*recode variables to 0-1 range*/

gen hatecrime=(hatecrime1-1)/4
gen blm=(blm1-1)/4

gen borderpat=(borderpat1-1)/4
gen daca=(daca1-1)/4
gen pathway=(pathway1-1)/4

summ hatecrime blm borderpat daca pathway

**create policy scales for each domain

gen prolat=(borderpat+daca+pathway)/3
summ prolat

gen problk=(blm+hatecrime)/2
summ problk


/*mediation analyses*/

**table 1

reg pocsolid american2

medeff (regress pocsolid american2) (regress hatecrime american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)
medeff (regress pocsolid american2) (regress blm american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)
medeff (regress pocsolid american2) (regress problk american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)

medeff (regress pocsolid american2) (regress borderpat american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)
medeff (regress pocsolid american2) (regress pathway american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)
medeff (regress pocsolid american2) (regress daca american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)
medeff (regress pocsolid american2) (regress prolat american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)


**no sensitivity analysis conducted due to lack of treatment effect on mediator among black participants


/*revisions for referees at Research & Politics during peer review*/


/*national origins among African Americans*/

tab Q3
tab Q3, nolabel


/*results are robust to inclusion of failed checks*/

**be sure to include all respondents by re-running this file without the coding of the manipulation checks

**table SI.8

reg pocsolid american2 

medeff (regress pocsolid american2) (regress hatecrime american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)
medeff (regress pocsolid american2) (regress blm american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)
medeff (regress pocsolid american2) (regress problk american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)

medeff (regress pocsolid american2) (regress borderpat american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)
medeff (regress pocsolid american2) (regress pathway american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)
medeff (regress pocsolid american2) (regress daca american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)
medeff (regress pocsolid american2) (regress prolat american2 pocsolid), mediate(pocsolid) treat(american2) sims(1000) seed(1)
